﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using Lottery.Control;

namespace Lottery.MediaData.UI.Control {
    /// <summary>
    /// 文字 录入控件
    /// </summary>
    public partial class WZInput : UserControl {
        public WZInput() {
            InitializeComponent();

            m_controls.Add(wzControl1);
            m_controls.Add(wzControl2);
            m_controls.Add(wzControl3);
            m_controls.Add(wzControl4);
            m_controls.Add(wzControl5);
            m_controls.Add(wzControl6);
            m_controls.Add(wzControl7);
            m_controls.Add(wzControl8);
            m_controls.Add(wzControl9);
            m_controls.Add(wzControl10);
            m_controls.Add(wzControl11);
            m_controls.Add(wzControl12);
            m_controls.Add(wzControl13);
            m_controls.Add(wzControl14);

            for (int i = 0; i < Count; i++) {
                this[i].Index = i + 1;
            }

            for (int i = 0; i < Count - 1; i++) {
                this[i].JumpToNext = this[i + 1];
            }
        }

        private List<WZControl> m_controls = new List<WZControl>();

        public WZControl this[int index] {
            get { return m_controls[index]; }
        }

        public int Count {
            get { return m_controls.Count; }
        }

        public void ClearData() {
            for (int i = 0; i < Count; i++) {
                var item = m_controls[i];
                item.Clear();
            }
        }

        public void SetDefaultValue() {
            for (int i = 0; i < this.Count; i++) {
                var item = this[i];
                item.SetDefaultValue();
            }
        }

        public void SetCC(List<int> cc) {
            var list = cc;
            var cl = new List<WZControl>();
            for (int i = 0; i < this.Count; i++) {
                var item = this[i];
                var isOK = list.IndexOf(i) != -1;
                item.Enabled = isOK;
                if (isOK) cl.Add(item);
            }

            for (int i = 0; i < cl.Count; i++) {
                if (i < cl.Count - 1) {
                    cl[i].JumpToNext = cl[i + 1];
                }
            }
        }

    }
}
